﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace WindowsGame1
{
    class Shot:AnimatedObject2D
    {
        private Vector2 dir = Vector2.One*100f;
        public Vector2 Dir
        {
            get { return dir; }
            set {
                if(dir == Vector2.One*100f)
                dir = value;
            }
        }
        private bool velAlter;
        private float vel;
        public float Vel
        {
            get { return vel; }
            set {
                if (!velAlter)
                {
                    velAlter = true;
                    vel = value;
                }
            }
        }
        private float creationTime;
        public float CreationTime
        {
            get { return creationTime; }

        }

        public Shot(Vector2 posicao, Color cor, 
            Texture2D textura, Animation[] animations,
            float c, float v, Vector2 d , float r)
            : base(posicao, cor, textura, animations)
        {
            this.Camada = 1;
            this.creationTime = c;
            this.Vel = v;
            Dir = d;
            this.Rotacao = r;
        }
        public override void Update(GameTime gameTime)
        {
            Posicao += Dir * Vel;
            base.Update(gameTime);
        }
    }
}
